# Contributor: H <agathos5@gmail.com>
# Maintainer:
pkgname=megatools
pkgver=1.10.3
pkgrel=0
pkgdesc="collection of programs for accessing Mega.nz service"
url="https://megatools.megous.com"
arch="all"
license="GPL-2.0-only"
makedepends="curl-dev glib-dev openssl-dev gmp-dev asciidoc"
subpackages="$pkgname-doc"
source="https://megatools.megous.com/builds/megatools-$pkgver.tar.gz"

build() {
	./configure --prefix=/usr
	make
}

check() {
	make check
	for i in  megacopy megadf megadl megaget megals megamkdir megaput megareg megarm; do
		msg $i
		./$i --version
	done
}

package() {
	#make DESTDIR="$pkgdir" install
	./install-sh -c -d "$pkgdir/usr/bin"
	./install-sh -c -d "$pkgdir/usr/share/doc/megatools"
	./install-sh -c -d "$pkgdir/usr/share/man/man1"
	./install-sh -c -d "$pkgdir/usr/share/man/man5"
	./install-sh -c -d "$pkgdir/usr/share/man/man7"
	./install-sh -c -m 755 megacopy megadf megadl megaget megals megamkdir megaput megareg megarm "$pkgdir/usr/bin"
	./install-sh -c -m 644 LICENSE NEWS TODO README INSTALL HACKING "$pkgdir/usr/share/doc/megatools"
	./install-sh -c -m 644 docs/megadf.1 docs/megaget.1 docs/megals.1 docs/megamkdir.1 docs/megaput.1 docs/megareg.1 docs/megarm.1 \
													docs/megacopy.1 docs/megadl.1 "$pkgdir/usr/share/man/man1"
	./install-sh -c -m 644 docs/megarc.5 "$pkgdir/usr/share/man/man5"
	./install-sh -c -m 644 docs/megatools.7 "$pkgdir/usr/share/man/man7"
}

sha512sums="cf431e151f3f7e1a77fcfe07092694f861eca43ab88bb4e0d4de72f01662e9140c51891f8f5cf3cf66d3a04b64a55d57fd766c3febf2fc5cee1720558ff2079b  megatools-1.10.3.tar.gz"
